/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.app.model.entities;

import java.io.Serializable;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Santiago
 */
@Entity
@Table(name = "jmb_post_tags")
@XmlRootElement
@NamedQueries({
  @NamedQuery(name = "JmbPostTags.findAll", query = "SELECT j FROM JmbPostTags j"),
  @NamedQuery(name = "JmbPostTags.findByTagId", query = "SELECT j FROM JmbPostTags j WHERE j.tagId = :tagId"),
  @NamedQuery(name = "JmbPostTags.findByTagName", query = "SELECT j FROM JmbPostTags j WHERE j.tagName = :tagName"),
  @NamedQuery(name = "JmbPostTags.findByTagPostId", query = "SELECT j FROM JmbPostTags j WHERE j.tagPostId = :tagPostId")})
public class JmbPostTags implements Serializable {
  private static final long serialVersionUID = 1L;
  @Id
  @SequenceGenerator(name = "tags_id_generator", sequenceName = "jmb_post_tags_tag_id_seq", allocationSize = 1)
  @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "tags_id_generator")
  @Basic(optional = false)
  @NotNull
  @Column(name = "tag_id",unique=true, nullable=false)
  private Integer tagId;
  @Size(max = 50)
  @Column(name = "tag_name")
  private String tagName;
  @Column(name = "tag_post_id")
  private Integer tagPostId;

  public JmbPostTags() {
  }

  public JmbPostTags(Integer tagId) {
    this.tagId = tagId;
  }

  public Integer getTagId() {
    return tagId;
  }

  public void setTagId(Integer tagId) {
    this.tagId = tagId;
  }

  public String getTagName() {
    return tagName;
  }

  public void setTagName(String tagName) {
    this.tagName = tagName;
  }

  public Integer getTagPostId() {
    return tagPostId;
  }

  public void setTagPostId(Integer tagPostId) {
    this.tagPostId = tagPostId;
  }

  @Override
  public int hashCode() {
    int hash = 0;
    hash += (tagId != null ? tagId.hashCode() : 0);
    return hash;
  }

  @Override
  public boolean equals(Object object) {
    // TODO: Warning - this method won't work in the case the id fields are not set
    if (!(object instanceof JmbPostTags)) {
      return false;
    }
    JmbPostTags other = (JmbPostTags) object;
    if ((this.tagId == null && other.tagId != null) || (this.tagId != null && !this.tagId.equals(other.tagId))) {
      return false;
    }
    return true;
  }

  @Override
  public String toString() {
    return "org.app.model.entities.JmbPostTags[ tagId=" + tagId + " ]";
  }
  
}
